package cn.assumejson.springframework.aop.aspectj;

import cn.assumejson.springframework.aop.MethodMatcher;

import java.lang.reflect.Method;

/**
 * @author gang.Li
 * @version 1.0
 * @since 1.0 2021/12/9 20:53
 */
public class TrueMethodMatcher implements MethodMatcher {


    public static final MethodMatcher INSTANCE = new TrueMethodMatcher();

    private TrueMethodMatcher() {
    }

    @Override
    public boolean matches(Method method, Class<?> targetClass) {
        return true;
    }


    @Override
    public String toString() {
        return "MethodMatcher.TRUE";
    }

    /**
     * Required to support serialization. Replaces with canonical
     * instance on deserialization, protecting Singleton pattern.
     * Alternative to overriding {@code equals()}.
     */
    private Object readResolve() {
        return INSTANCE;
    }
}
